﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KTX.Public;

namespace KTX.Data
{
   public class KhoaData
    {
       ClsKetNoi cls = new ClsKetNoi();
       public DataTable LoadKhoa()
       {
           return cls.LayDuLieu("select * from KHOA");
       }
       public DataTable TimtheoMaKhoa(KhoaPublic p)
       {
           int NParameter = 1;
           string[] name = new string[NParameter];
           object[] value = new object[NParameter];
           name[0] = "@ma_khoa";
           value[0] = p.KhoaMa;
           return cls.LayDuLieu("select * from khoa where ma_khoa = @ma_khoa", name, value, NParameter);
       }

       public int xoa (KhoaPublic p)
       {
           int NParameter = 1;
           string[] name = new string[NParameter];
           object[] value = new object[NParameter];
           name[0] = "@ma_khoa";
           value[0] = p.KhoaMa;
           return cls.Update("delete from khoa where ma_khoa = @ma_khoa", name, value, NParameter);
       }

    }
}
